<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<style>
    .red{
        color:red;
    }
    .orange{
        background: orange
    }
</style>

<body>
    <div id="app">
        <p>{{computedNum}}</p>
        <p><input type="text" v-model="computedNum"></p>
    </div>
    <script src="./base/vue.min.js"></script>
    <script>

        new Vue({
            el:"#app",
            data:{
                msg:"hello world"
            },
            computed:{
                // computedNum(){ //只能取值  类似于下面  get的写法
                //     return this.msg;
                // }
                computedNum:{
                    get(){
                        return this.msg;
                    },
                    set(val){//改变计算属性的话写set
                        this.msg = val;
                    }
                }
            }
        })

    </script>
</body>

</html>